package com.ityedao.IO打印流;

import java.io.PrintStream;
import java.nio.charset.Charset;

public class PrintStreamTest {
    public static void main(String[] args) {
        try (
                // 1、创建一个打印流管道
                PrintStream ps =
                        new PrintStream("src/ityedao-打印流.txt", Charset.forName("GBK"));
        ) {
            ps.print(97);
            ps.println("我爱你中国");
            ps.println(true);
            ps.println('a');

            byte[] bytes = {'a', 'b', 'c'};
            ps.write(bytes, 0, 2);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
